/**
 * @projectName: AppProject
 * @package: PACKAGE_NAME
 * @className: Work3
 * @author: Kvzjj
 * @description: TODO
 * @date: 2023/9/13 8:22
 * @version: 1.0
 */
public class Work3 {
    public static void main(String[] args) {
        int count=0;
        for(int i=2;i<=20000;i++){
            int q= (int) (Math.sqrt(i))+1;
            for(int j=2;j<=q;j++){
                if(i%j==0&&j!=i){
                    break;
                }
                if(j==q){

                    if(count<5){
                        System.out.print(i+" ");
                    }else {
                        count=0;
                        System.out.println(i);
                    }
                    count++;

                }
            }
        }
    }
}
